export default {
  methods: {
    /**
     * 格式化数字
     * Formats a number with Chinese-style formatting
     * @param {number} num - The number to format
     * @returns {string|number} Formatted number with '万' suffix if >= 10000, or original number
     * @throws {TypeError} If input is not a number
     */
    formatNumber(num) {
      if (num && sa.isNumber(num)) {
        if (num >= 100000000) {
          return (num / 100000000).toFixed(2) + ' 亿';
        }
        if (num >= 100000) {
          return (num / 100000).toFixed(2) + ' 万';
        }
        if (num >= 1000) {
          return (num / 1000).toFixed(2) + ' k';
        }
        return num;
      }
    }
  }
}
